package com.wlm.Utils;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResultVo<T> {

    private Integer code;
    private String msg;
    private T data;

    public ResultVo(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static <T> ResultVo<T> success(){
        return new ResultVo(200, "成功");
    }

    public static <T> ResultVo<T> success(Integer code, String msg){
        return new ResultVo(code, msg);
    }

    public static ResultVo<Void> fail() {
        return new ResultVo(201, "失败");
    }
}
